from django.urls import path, include
from rest_framework.routers import DefaultRouter

from home.api.carousel import CarouselViewSet
# 导入视图函数
from home.views import home
from home.api.answer import *
from home.api.category import *
from home.api.upload import *
from home.api.user import *
from home.api.question import *
from home.api.verify import *

# 应用命名空间
app_name = 'home'
# 创建一个路由实例
router=DefaultRouter()
# 注册路由
router.register(r'user',UserViewSet,basename='user')
router.register(r'questions',QuestionListViewSet,basename='questions')
router.register(r'question',QuestionCreateViewSet,basename='question')
router.register('userinfo',UserInfoViewSet,basename='userinfo')
router.register('category',CategoryViewSet,basename='category')
router.register('answer',AnswerViewSet,basename='answer')
router.register('verify',VerifyCodeViewSet,basename='verify')
router.register('upload',EditorUploadViewSet,basename='upload')
router.register('carousel',CarouselViewSet,basename='carousel')
# 配置路由规则
urlpatterns = [
    path('api/',include(router.urls)),
    path('', home, name='home')
]